package backend;

import gui.Shortcut;
import gui.ShortcutFactory;

import java.io.File;
import java.util.UUID;
import java.util.Vector;

public class WindowShortcutsLoader {
	public Vector<Shortcut> getShortcutFiles(Vector<Shortcut> shortcuts,
			ShortcutFactory factory) {
		File shortcutsRoot = new File(PathHandler.GetLocalPath()
				+ PathHandler.SHORTCUTS_FOLDER);
		if (shortcutsRoot.exists()) {
			String[] filesInDir = shortcutsRoot.list();
			File lnkFile;
			for (int i = 0; i < filesInDir.length; i++) {
				if (filesInDir[i].endsWith(".lnk")) {
					System.out.println(filesInDir[i]);
					lnkFile = new File(shortcutsRoot.getAbsolutePath()+"\\" + filesInDir[i]);
					shortcuts.add(factory.createShortcut(null, lnkFile.getPath(),filesInDir[i].replace(".lnk",""),"")); 
			
				}
			}
		}
		else
			shortcutsRoot.mkdir();

		return shortcuts;

	}
	
}
